package xyz.csmcool.imchat.service;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.multipart.MultipartFile;
import xyz.csmcool.imchat.entity.FileMessageVo;
import xyz.csmcool.imchat.entity.RoomsChats;
import com.baomidou.mybatisplus.extension.service.IService;
import xyz.csmcool.imchat.entity.vo.RoomChatsVo;
import xyz.csmcool.imutil.dto.LastMessageDto;
import xyz.csmcool.imutil.dto.Message;
import xyz.csmcool.imutil.webVo.MyPage;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author csmcool
 * @since 2022-08-14
 */
public interface IRoomsChatsService extends IService<RoomsChats> {

    /**
     * sendMessage
     * @param message
     * @param uid
     * @return
     */
    Message<String> sendMessage(Message<String> message,String uid);


    /**
     * sendImageMessage
     * @param files
     * @param uid
     * @param roomId *
     * @return
     */
    void sendImageMessage(MultipartFile[] files, String uid,Integer roomId);

    /**
     * sendSoundMessage
     * @param file
     * @param uid
     * @param roomId *
     * @return
     */
    void sendSoundMessage(MultipartFile file, String uid,Integer roomId);

    /**
     * sendFileMessage
     * @param file
     * @param uid
     * @param roomId *
     * @return
     */
    void sendFileMessage(MultipartFile file, String uid,Integer roomId);

    /**
     * sendMp4Message
     * @param file
     * @param uid
     * @param roomId *
     * @return
     */
    void sendMp4Message(MultipartFile file, String uid,Integer roomId);


    /**
     * send*
     * @param fileMessageVo
     * @param uid
     */
    void sendRoomFileMessage(FileMessageVo fileMessageVo, String uid);


    /**
     * 获取每个房间的最后一条信息*
     * @param ids
     * @return
     */
    List<LastMessageDto> getLastMessage(List<Integer> ids);

    /**
     * 第一次获取历史消息记录
     * @param roomId
     * @return
     */
    List<RoomChatsVo> getFirstHistory(Integer roomId,Integer uid);

    /**
     * 查看历史消息
     * @param page
     * @param limit
     * @param roomId
     * @param id
     * @return
     */
    MyPage<RoomChatsVo> getHistoryMessage(Long page, Long limit, Integer roomId, Integer id,Integer uid);

    /**
     * 查看历史图片
     * @param page
     * @param limit
     * @param roomId
     * @param id
     * @return
     */
    MyPage<String> getHistoryImg(Long page, Long limit, Integer roomId, Integer id);

    /**
     * 查看历史文件
     * @param page
     * @param limit
     * @param roomId
     * @param id
     * @return
     */
    MyPage<String> getHistoryFile(Long page, Long limit, Integer roomId, Integer id);

    /**
     * 删除聊天记录*
     * @param roomId
     * @return
     */
    Boolean deleteRoomChats(Integer roomId);

    /**
     * 清空聊天室
     * @param roomId
     * @param uid
     * @return
     */
    void clearRoomChats(Integer roomId,Integer uid);
}
